using System.Collections.Generic;
using Microsoft.Xna.Framework;

namespace Game500.Client.Src.Logic
{
  internal class ClientPrototypeManager
  {
    private readonly Dictionary<string, Renderable> myPrototypes = new Dictionary<string, Renderable>();

    public ClientPrototypeManager(ResourceManager resourceManager, ObjectManager objectManager)
    {
      CreatePrototypes(resourceManager, objectManager);
    }

    public Renderable GetEntity(string resourceId)
    {
      return myPrototypes[resourceId].Clone();
    }

    private void CreatePrototypes(ResourceManager resource, ObjectManager objectManager)
    {
      myPrototypes["plane#red"] = new Plane(resource.GetTexture("plane_red.png"), resource, objectManager, Color.Red) {Z = 0.9f};
      myPrototypes["plane#green"] = new Plane(resource.GetTexture("plane_green.png"), resource, objectManager, Color.Green) {Z = 0.9f};
      myPrototypes["plane#yellow"] = new Plane(resource.GetTexture("plane_yellow.png"), resource, objectManager, Color.Yellow) {Z = 0.9f};
      myPrototypes["plane#blue"] = new Plane(resource.GetTexture("plane_blue.png"), resource, objectManager, Color.Blue) {Z = 0.9f};
      myPrototypes["shell"] = new Sprite(resource.GetTexture("shell.png")) {Scale = new Vector2(0.15f)};
    }
  }
}